#include <iostream>
using namespace std;

class CRectangle
{
protected:
    double width, height;
public:
    CRectangle(int wid=1, int hei=1):width(wid),height(hei) {}
    int getWidth()
    {
        return width;
    }
    void setWidth(int newWid)
    {
        width = newWid;
    }
    int getHeight()
    {
        return height;
    }
    void setHeight(int newHei)
    {
        height = newHei;
    }
    int area()
    {
        return width*height;
    }
    int perimeter()
    {
        return (width+height)*2;
    }
    void scale(double fw, double fh)
    {
        width*=fw;
        height*=fh;
    }
};

class CSquare : public CRectangle
{
public:
    CSquare(int edge):CRectangle(edge, edge) {}
    void scale(double fe)
    {
        CRectangle::scale(fe, fe);
    }
};

int main()
{
    CRectangle r(2, 3);
    cout<<"Rectangle:"<<r.getHeight()<<","<<r.getWidth()<<endl;
    cout<<"area="<<r.area()<< "\tperimeter= "<<r.perimeter()<<endl;
    r.scale(3, 4);
    cout<<"Rectangle:"<<r.getHeight()<<","<<r.getWidth()<<endl;
    cout<<"area="<<r.area()<< "\tperimeter= "<<r.perimeter()<<endl;

    CSquare s(3);
    cout<<"Square:"<<s.getHeight()<<","<<s.getWidth()<<endl;
    cout<<"area="<<s.area()<< "\tperimeter= "<<s.perimeter()<<endl;
    s.scale(2);
    cout<<"Square:"<<s.getHeight()<<","<<s.getWidth()<<endl;
    cout<<"area="<<s.area()<< "\tperimeter= "<<s.perimeter()<<endl;
}




